package com.penghaonan.appframework.utils;

import android.text.TextUtils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class StringUtils {
    public static boolean equals(String s1, String s2) {
        if (s1 == null) {
            return s2 == null;
        }else {
            return s1.equals(s2);
        }
    }

    public static boolean isUrl(String url) {
        if (TextUtils.isEmpty(url)) {
            return false;
        }
        String pattern = "^((ht|f)tps?):\\/\\/([\\w\\-]+(\\.[\\w\\-]+)*\\/)*[\\w\\-]+(\\.[\\w\\-]+)*\\/?(\\?([\\w\\-\\.,@?^=%&:\\/~\\+#]*)+)?";
        Pattern r = Pattern.compile(pattern);
        Matcher m = r.matcher(url);
        return m.matches();
    }
}
